package com.hejing.单例模式;

/**
 * ClassName: BankTest
 * Package: com.hejing.单例模式
 * Description:
 *      单例模式测试:
 * @Author: HeJing
 * @Create: 2023-03-28 9:41
 * @Version: 1.0
 */
public class SingleTest {
    public static void main(String[] args) {

        // 饿汉式单例模式测试:
        BankEHang bank1 = BankEHang.getInstance();
        BankEHang bank2 = BankEHang.getInstance();
        System.out.println(bank1 == bank2);

        // 懒汉式单例模式测试:
        GirlFriendLangHang g1 = GirlFriendLangHang.getInstance();
        GirlFriendLangHang g2 = GirlFriendLangHang.getInstance();
        System.out.println(g1 == g2);
    }
}




























